home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Screenblankers / RXBlank / RXBlank next >
Text File  |  1996-09-26  |  4KB  |  120 lines

  1. /*
  2. ** RXBlank v1.0
  3. ** By Brian C. Berg
  4. ** 19-Jan-92
  5. ** 
  6. ** This little AREXX program will install a random screen blanker in your
  7. ** WBStartup drawer.                                          
  8. **
  9. ** USAGE: RX RXBlank <pathname>
  10. **    
  11. */
  12.  
  13. OPTIONS RESULTS
  14.  
  15. /**************************************************************************/
  16.                  /**** IS REXXSUPPORT.LIBRARY OPEN? ****/
  17. /**************************************************************************/
  18. if ~show('L', "rexxsupport.library") then do
  19.     if addlib('rexxsupport.library', 0, -30,0) then do
  20.         say ""
  21.     end
  22.     else do
  23.         say "RexxSupport.library not available, exiting..."
  24.         exit 10
  25.     end
  26. end
  27. /**************************************************************************/
  28.  
  29.  
  30.  
  31. /**************************************************************************/
  32.                         /**** PARSE ARGUMENTS ****/
  33. /**************************************************************************/
  34. parse arg path 
  35.  
  36. IF (path = '') | (path = '?') then do                /* No path given    */
  37.     say "RXBlank v1.0  By Brian C. Berg"             /* so display usage */
  38.     say "USAGE: RXBlank <pathname>"
  39.      exit
  40. END
  41.  
  42. IF (~exists(path)) then do                             /* Can't find path */
  43.     say "Can't find path "path
  44.      exit
  45. END
  46.  
  47. trim(path)                    /* Check for / at end of path and add one*/
  48. IF right(path, 1) ~= "/" then do   /* if not already there. */
  49.     path = path"/"
  50. END
  51. /**************************************************************************/
  52.  
  53.  
  54.  
  55. /**************************************************************************/
  56.                 /*********** MAIN PROGRAM ***************/
  57. /**************************************************************************/
  58. say "RXBlank v1.0  By Brian C. Berg"
  59.  
  60. files = showdir(path, "f")                            /* Get list of  */
  61. IF ~open('list', 'ram:RXBlank.temp', "W") then do        /* files in the */
  62.     say "Can't open temporary file in RAM:, exiting..."    /* directory.   */
  63. END
  64.  
  65. numwords = words(files)    /* Initialize some variable */
  66. x = 1
  67. num = 0
  68.  
  69. do while (x <= numwords)   /* Loop to sort through all files in the dir */
  70.     call STRIPNAMES
  71.     x = x + 1
  72. end
  73.  
  74. close('list')                            /* Close and reopen temp file */
  75. open('list', 'ram:RXBlank.temp', "R")      /* to reset pointer.          */
  76.  
  77. call CHOOSEBLANKER                               /* Pick the random number */
  78. close('list')                                 /* Close the temp file */
  79. ADDRESS COMMAND 'delete >nil: ram:RXBlank.temp'  /* and delete it       */
  80. EXIT
  81. /**************************************************************************/
  82. /**************************************************************************/
  83.  
  84.  
  85.  
  86. /**************************************************************************/
  87.                      /******** SUB ROUTINES ********/
  88. /**************************************************************************/
  89.  
  90. STRIPNAMES:                        /* This routine will find all files */
  91.  name = word(files, x)                /* in the directory and pick out    */
  92.  if right(name, 5) ~= '.info' then do    /* the blankers from the .info files*/
  93.  
  94.      writeln('list', name)
  95.      num = num + 1
  96.  end
  97. RETURN
  98.  
  99. /*------------------------------------------------------------------------*/
  100.  
  101. CHOOSEBLANKER:                           /* This routine picks a random number*/
  102.                                          /* based on how many blankers it found */
  103.                                          /* and then copies it to the WBstartup*/
  104.                                          /* drawer along with it's icon.*/
  105.  
  106. Bnum = random(1,num,random(1,100,(TIME(SECONDS))))
  107.  
  108.  y = 1                                  
  109.  do while (y <= Bnum)
  110.      name = readln('list')
  111.      y = y + 1
  112.  end
  113.  
  114. ADDRESS COMMAND 'copy >nil: 'path''name' SYS:WBStartup/Blanker'
  115. ADDRESS COMMAND 'copy >nil: 'path''name'.info SYS:WBStartup/Blanker.info'
  116. say 'Blanker Installed: 'name
  117.  
  118. RETURN
  119. /**************************************************************************/
  120.